In [1]:
using PyPlot
import DSP
In [2]:
include("../juwvid.jl")
Out[2]:
In [3]:
nsample=512
t,x=sampledata.genmultifm623(nsample);
PyPlot.plot(t,x)
PyPlot.ylabel("y")
PyPlot.xlabel("t")
Out[3]:
In [4]:
sm=smethod.tfrsm(x,NaN,4,NaN,2);
In [5]:
a=juwplot.wtfrshow(sm,t[2]-t[1],t[1],t[end],NaN,NaN,1.0)
PyPlot.xlabel("time")
PyPlot.ylabel("frequency")
PyPlot.ylim(0,65)
Out[5]:
In [6]:
#alias free sm
afwv=smethod.tfrsm(x,NaN,4,NaN,2)
#L wigner distribution (L=2)
tfrlw2=lwigner.tfrlw2L(afwv,4);
a=juwplot.wtfrshow(tfrlw2,t[2]-t[1],t[1],t[end],NaN,NaN,1.0)
PyPlot.xlabel("time")
PyPlot.ylabel("frequency")
PyPlot.ylim(0,65)
Out[6]:
In [7]:
trfpo=polywv.tfrpowv(x,NaN,NaN,NaN,2,8);
a=juwplot.wtfrshow(trfpo,t[2]-t[1],t[1],t[end],NaN,NaN,1.0)
PyPlot.xlabel("time")
PyPlot.ylabel("frequency")
PyPlot.ylim(0,65)
Out[7]:
In [8]:
tfrst=stft.tfrstft(x);
In [9]:
fig=PyPlot.figure()
ax = fig[:add_subplot](2,2,1)
a=juwplot.wtfrshow(abs.(tfrst).^2,t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2)
PyPlot.ylabel("frequency")
PyPlot.title("Spectrogram")
PyPlot.ylim(0,65)
ax = fig[:add_subplot](2,2,2)
a=juwplot.wtfrshow(abs.(sm),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2)
PyPlot.title("S-method")
PyPlot.ylim(0,65)
ax = fig[:add_subplot](2,2,3)
a=juwplot.wtfrshow(abs.(tfrlw2),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2)
PyPlot.xlabel("time")
PyPlot.ylabel("frequency")
PyPlot.title("L-wigner")
PyPlot.ylim(0,65)
ax = fig[:add_subplot](2,2,4)
a=juwplot.wtfrshow(abs.(trfpo),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2)
PyPlot.xlabel("time")
PyPlot.title("Polynomial WV")
PyPlot.ylim(0,65)
Out[9]:
In [10]:
using Distributions
d = Normal()
xnoise=x+rand(d,nsample)*std(x)*0.5
PyPlot.plot(t,xnoise)
Out[10]:
In [11]:
tfrst=stft.tfrstft(xnoise);
#alias free sm
sm=smethod.tfrsm(xnoise,NaN,4,NaN,2)
#L wigner distribution (L=2)
tfrlw2=lwigner.tfrlw2L(sm,4);
trfpo=polywv.tfrpowv(xnoise,NaN,NaN,NaN,2,8);
In [12]:
fig=PyPlot.figure()
ax = fig[:add_subplot](2,2,1)
a=juwplot.wtfrshow(abs.(tfrst).^2,t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2)
PyPlot.ylabel("frequency")
PyPlot.title("Spectrogram")
PyPlot.ylim(0,65)
ax = fig[:add_subplot](2,2,2)
a=juwplot.wtfrshow(abs.(sm),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2)
PyPlot.title("S-method")
PyPlot.ylim(0,65)
ax = fig[:add_subplot](2,2,3)
a=juwplot.wtfrshow(abs.(tfrlw2),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2)
PyPlot.xlabel("time")
PyPlot.ylabel("frequency")
PyPlot.title("L-wigner")
PyPlot.ylim(0,65)
ax = fig[:add_subplot](2,2,4)
a=juwplot.wtfrshow(abs.(trfpo),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2)
PyPlot.xlabel("time")
PyPlot.title("Polynomial WV")
PyPlot.ylim(0,65)
Out[12]: